-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Function::{ScriptId, GetScriptOrigin}, ScriptOrigin::Get{ScriptId, ResourceName, SourceMapUrl}
bindings
#1250
Conversation
src/function.rs
Outdated
|
||
/// Returns scriptId. | ||
#[inline(always)] | ||
pub fn get_script_id(&self) -> Option<u32> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be i32?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was unsure about this. V8 docs are sparse on when a script ID is < 0, but the only cases I could find in the source were 1) uninitialized ScriptOrigin classes (value is -1) and 2) kTemporaryScriptId = -2. Due to uncertainty on when these cases actually occur, I just treated these as None values.
I can change this to i32 instead if you think that would make more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mmastrac Would you suggest i32 instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should use i32
here. Also please remove get_
prefix - in v8/include/v8-function.h
this function is named ScriptId()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done @bartlomieju @mmastrac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, just a few nitpicks to match V8 API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
@bartlomieju Great! When do you expect I currently depend on these for my project! |
@rakeeb-hossain we will release next week. Waiting on one V8 upgrade that fixes a long standing bug. |
I added the bindings in the title to use in an application! Let me know if I'm missing anything.